package com.dc.project.entity.dto;

import com.dc.project.entity.bo.TaskFileCommitBo;
import com.own.component.common.base.entity.BaseDto;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * TaskFileCommitDto
 *
 * @author chenxueli
 * @date 2025-03-10 16:37:53
 */
@Schema(title = "任务文件提交" + ConstantBeanSuffix.DTO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class TaskFileCommitDto extends BaseDto<TaskFileCommitBo> implements Serializable {

    @Schema(title = "任务id")
    private Long taskId;

    @Schema(title = "详情id")
    private Long detailId;

    @Schema(title = "项目id")
    private Long itemId;

    @Schema(title = "上传的附件id")
    private Long fileId;

    @Schema(title = "上传的附件路径")
    private String filePath;

    @Schema(title = "提交类型 1=task 2=detail 3=item")
    private Integer type;

    @Schema(title = "提交的目标id")
    private Long targetId;

    @Schema(title = "解析状态 1=等待执行中 2=解析文本中 3=解析完成，压缩内容中 4=处理完成 5=解析失败 6=压缩内容失败 7=处理失败")
    private Integer status;

    @Schema(title = "解析消息")
    private String parseMessage;

    @Schema(title = "资料所属年份")
    private String year;

    @Schema(title = "资料所属类别")
    private String category;

    @Schema(title = "序号")
    private Integer sortOrder;

    /**
     * 转业务层对象
     *
     * @param entity 原业务层对象
     * @return 业务层对象
     */
    @Override
    public TaskFileCommitBo toBo(TaskFileCommitBo entity) {
        if (entity == null) {
            entity = new TaskFileCommitBo();
        }
        entity.setTaskId(this.taskId);
        entity.setDetailId(this.detailId);
        entity.setItemId(this.itemId);
        entity.setFileId(this.fileId);
        entity.setFilePath(this.filePath);
        entity.setType(this.type);
        entity.setTargetId(this.targetId);
        entity.setStatus(this.status);
        entity.setParseMessage(this.parseMessage);
        entity.setYear(this.year);
        entity.setCategory(this.category);
        entity.setSortOrder(this.sortOrder);
        return super.toBo(entity);
    }

}

